#ifndef __CHATROOM_H__
#define __CHATROOM_H__

#include <iostream>
#include <string>
#include <json-c/json.h>
#include "stdTcpServer.h"
#include "sqliteDataBase.h"
#include <sqlite3.h>

class ChatRoom
{
public:
    ChatRoom(const StdTcpSocketPtr &client);
    ~ChatRoom();

public:
    /* 处理用户注册 */
    void handleRegisterInfo(const std::string &msg);
    /* 处理用户登录*/
    void handleLoginInfo(const std::string &msg);

private:
    /* 判断用户是否存在 */
    bool userIsExist(const std::string(&name));
    /* 保存用户信息 */
    bool saveUserInfo(const std::string &name, const std::string &passwd);

private:
    StdTcpSocketPtr m_clientInfo;

    SqliteDataBase m_sqliteDB;
};

#endif // __CHATROOM_H__
